package zhizhemodi.tech.short_term_bwork.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import zhizhemodi.tech.short_term_bwork.entity.Device;
import zhizhemodi.tech.short_term_bwork.mapper.DeviceMapper;

@Service
public class DeviceService {
    @Autowired
    DeviceMapper deviceMapper;

    public List<Device> findDevice(String column, Object num) {
        QueryWrapper<Device> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(column, num);
        return deviceMapper.selectList(queryWrapper);
    }

    /**
     * 通过设备编号删除设备
     * @param deviceId
     */
    public void deleteDevices(Integer deviceId) {
        QueryWrapper<Device> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("device_id", deviceId);
        deviceMapper.delete(queryWrapper);
    }
}
